<template>
	<view>
		<u-form-item class="formItem" :label-width="150" label="姓名:"><u-input v-model="name" :border='true' placeholder="请输入姓名"	/></u-form-item>
		<u-form-item class="formItem" :label-width="150" label="身份证:"><u-input v-model="idCard" :border='true' type="number" placeholder="请输入身份证号" 	/></u-form-item>
		<view style="padding: 20rpx;">
			<text style="font-size: 30rpx; padding: 20rpx">上传毕业证：</text>
			<u-upload :action="action"  @on-success='updiplom' ></u-upload>
		</view>
		<view style="padding: 20rpx;">
			<text style="font-size: 30rpx; padding: 20rpx">上传照片：</text>
			<u-upload :action="action" @on-success="upucc" ></u-upload>
		</view>
		<view @click="btnsignUp" class="sign_up">
			报名
		</view>
		<u-toast ref="uToast" />
	</view>
</template>

<script>
	export default {
		data() {
			return {
				captchaId:'',
				name:'',
				idCard:'',
				action:'http://47.115.35.16:9001//fileInput/tengxun',
				diplomaImg:'',
				upImg:''
			};
		},
		onLoad(option) {
			this.captchaId = option.id;
		},
		methods:{
			upucc(d, i, l) {
				let data = JSON.parse(d);
				this.upImg = data.path;
			},
			updiplom(d, i, l) {
				let data = JSON.parse(d);
				this.diplomaImg = data.path;
			},
			btnsignUp(){
				let data = {
					examId:this.captchaId,
					userName:this.name,
					idno:this.idCard,
					biYeZPath:this.diplomaImg,
					photo:this.upImg
				};
				this.$u.api.getappllication(data).then(res => {
					this.$refs.uToast.show({
						title: '报名成功',
						type: 'success',
					});
				}).catch(e => {
					this.$refs.uToast.show({
						title: '报名成功',
						type: 'error',
					});
				})
			}
		}
	}
</script>

<style lang="scss">
	.formItem{
		border-bottom: 1rpx solid #EEEEEE;
		padding: 20rpx;
	}
	.sign_up{
	width: 90%;
	padding: 20rpx;
	background: #05B2B5;
	color: #fff;
	border-radius: 50rpx;
	margin: 0 auto;
	text-align: center;
	font-size: 30rpx;
}
</style>
